
#import "VPTBarBtn.h"

@interface VPTBarBtn ()
{
    BOOL            _isSelectedMine;
    UIImageView*    _newMsgImgView;
}

@end

@implementation VPTBarBtn

-(void) setIsSelectedMine:(BOOL)isSel
{
    _isSelectedMine = isSel;
    _newMsgImgView.hidden = (!_isSelectedMine);
    [self setImage:(_isSelectedMine ?_selectImg:_normalImg) forState:UIControlStateNormal];
    [self setTitleColor:(_isSelectedMine ? _selectColor:_normalColor) forState:UIControlStateNormal];
}

-(BOOL) isSelectedMine
{
    return _isSelectedMine;
}

-(void) initMyContentWithFrame:(CGRect) frame
{
    [self setFrame:frame];
    [self setImage:_normalImg forState:UIControlStateNormal];
    [self setImage:_selectImg forState:UIControlStateHighlighted];
    
    [self setTitle:_rightTitle forState:UIControlStateNormal];
    self.titleLabel.font = [UIFont systemFontOfSize:9.f];
    
    [self setTitleColor:_normalColor forState:UIControlStateNormal];
    [self setTitleColor:_selectColor forState:UIControlStateHighlighted];
    

    [self setImageEdgeInsets:UIEdgeInsetsMake(-7, self.width * 0.5 - self.imageView.centerX, 7, self.imageView.centerX - self.width * 0.5)];
    [self setTitleEdgeInsets:UIEdgeInsetsMake(14, self.width * 0.5 - self.titleLabel.centerX, -14, self.titleLabel.centerX - self.width * 0.5)];
    
    self.exclusiveTouch = YES;
}
@end
